package com.example.kwokg.meishi;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.view.ViewGroup;

import java.util.List;

/**
 * Created by kwokg on 2016/9/10.
 */
public class MyVpAdapter extends FragmentPagerAdapter {

        private List<Fragment> mData;
        private String[] mTitles;
        public MyVpAdapter(FragmentManager fm, List<Fragment> list,String[] titles) {
            super(fm);
            this.mData=list;
            mTitles=titles;
        }

        @Override
        public Fragment getItem(int position) {
            return mData==null?null:mData.get(position);
        }

        @Override
        public int getCount() {
            return mData==null?0:mData.size();
        }

    @Override
    public CharSequence getPageTitle(int position) {

        return mTitles[position];
    }

    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {

    }
}
